﻿using System;
using Pap.Core.Utilities;
using Pap.Services;
using Pap.Web.Utils;

namespace Pap.Web.Modules.Loan.ViewModel
{
    /// <summary>
    /// 
    /// </summary>
    public class ExpertWaitingListViewModel : IViewModel
    {
        /// <summary>
        /// 
        /// </summary>
        IWorkflowService wfService;
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpertWaitingListViewModel"/> class.
        /// </summary>
        /// <param name="wf">The wf.</param>
        public ExpertWaitingListViewModel(IWorkflowService wf)
        {
            this.wfService = wf;
        }

        /// <summary>
        /// Takes the decision for loan.
        /// </summary>
        /// <param name="loanID">The loan ID.</param>
        /// <param name="action">The action.</param>
        /// <param name="Notes">The notes.</param>
        public void TakeDecisionForLoan(Guid loanID, Pap.Services.WorkflowEngine.ActionTypes action, string Notes)
        {
            Guid processInstanceID = wfService.GetProcessInstanceIDByEntity(loanID);
            wfService.Move(action, processInstanceID, RegistryInfo.UserID, Notes, null);
        }
    }
}
